package com.qyhl.webtv.module_news.news.jlnews.multi;


import com.qyhl.webtv.basiclib.utils.network.EasyHttp;
import com.qyhl.webtv.basiclib.utils.network.callback.SimpleCallBack;
import com.qyhl.webtv.basiclib.utils.network.exception.ApiException;
import com.qyhl.webtv.commonlib.entity.news.JLCityBean;
import com.qyhl.webtv.module_news.common.NewsUrl;

import java.util.List;

public class JLMultiNewsModel implements JLMultiNewsContract.JLMultiNewsModel {
    private JLMultiNewsPresenter mPresenter;

    JLMultiNewsModel(JLMultiNewsPresenter mPresenter) {
        this.mPresenter = mPresenter;
    }

    @Override
    public void getCityList() {
        EasyHttp.get(NewsUrl.JL_NEWS_CITY)
                .execute(new SimpleCallBack<List<JLCityBean>>() {
                    @Override
                    public void onError(ApiException e) {
                        mPresenter.setError();
                    }

                    @Override
                    public void onSuccess(List<JLCityBean> jlCityBeans) {
                        mPresenter.setCityList(jlCityBeans);
                    }
                });
    }
}
